<?php  ?>
<div class="row full_width">
    <div class="large-12 columns">

    </div>
</div>

<div class="row full_width">

<div class="large-2 columns nav__">
    <br />
    <ul class="side-nav nav_ panel">
        <li><h5>Action</h5></li>
        <li class="divider"></li>
        <?php if($typeh < 2){ ?>
        <li class=""><a href="#" data-reveal-id="myModal">Add announcement</a></li>
        <?php } ?>
        <li class=""><a href="<?php echo site_url('information/logout'); ?>">Log-out</a></li>
    </ul>
</div>
<br />

<div class="large-9 push-1 columns panel">
    <h5>Announcement</h5>
    <hr />
    <div class="row collapse">

        <?php

            if(empty($annc))
                echo "No announcements made yet.";
            else
            foreach($annc as $item){
                //echo var_dump($annc);
                ?>

                <div class="large-12 columns panel" style="padding: 10px; background-color: #99FFCC;">
                    <h4><?php echo $item['title']; ?>
                        <?php if( $type == 0 or ($item['coll_id'] == $college_user and $type == 1 and $item['type_no'] != 0 and $item['coll_id'] == $college_user)){ ?>
                        <small><a href="<?php echo site_url('announcement/delete/' . $item['annc_id']) ?>">Delete</a></small>
                        <?php } ?>
                    </h4>
                    <h4><small><?php echo "By: " . $item['name_type']; ?></small></h4> <br />
                    <h4><small><?php echo $item['coll_name']; ?></small></h4>

                    <hr style="border-color: #000000;"/>
                    <p><?php echo $item['content']; ?></p>
                </div>

                <?php

            }
        ?>

        <p><?php echo $links; ?></p>
    </div>
</div>

</div>

<div id="myModal" class="reveal-modal small" data-reveal>
    <h2>Add an announcement</h2>
    <hr />

    <?php echo validation_errors(); ?>

    <?php echo form_open('announcement/add_announcement', 'data-abide') ?>

    <div class="row">
        <div class="large-4 columns">
            <label class="inline" for="title">Title:<br /><small>*Required</small></label>
        </div>
        <div class="large-5 columns">
            <input type="text" id="title" name="title" value="" required=""/>
            <small class="error">Title is required.</small>
        </div>
        <div class="large-3 columns"></div>
    </div>

    <div class="row">
        <div class="large-4 columns">
            <label class="inline" for="desc">Description:<br /><small>*Required</small></label>
        </div>
        <div class="large-5 columns">
            <textarea id="desc" name="desc" value="" required="" ></textarea>
            <small class="error">Description is required.</small>
        </div>
        <div class="large-3 columns"></div>
    </div>

    <?php if($type == 0){ ?>

    <div class="row">
        <div class="large-4 columns">
            <label class="inline" for="spec">Announce this to:<br /><br />If left blank, it would send to all.</label>
        </div>

        <div class="large-5 columns">

            <div style="overflow: scroll; overflow-x: hidden; border:1px solid grey; height:200px; width: 100%; padding-top: 0px; padding-left: 0px;">
                <table width="100%">
                <?php foreach($college as $item): ?>
                <tr>
                    <td><input id="college<?php echo $item['coll_id']; ?>" name="college[]" type="checkbox" value="<?php echo $item['coll_id']; ?>" /></td>
                    <td><label for="college<?php echo $item['coll_id']; ?>"><?php echo $item['coll_name']; ?></label></td>
                </tr>
                <?php endforeach ?>
                </table>
            </div>
            <small class="error">Pick one.</small>
        </div>

        <div class="large-3 columns"></div>
    </div>

    <?php } ?>

    <input class="button small" type="submit" name="submit" value="Submit" />

    <?php echo form_close(); ?>

    <a class="close-reveal-modal">&#215;</a>
</div>